package guda.stark.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.stark.dal.dao.ParkingRentRuleDAO;
import guda.stark.dal.dataobject.ParkingRentRuleDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ParkingRentRuleDAOImpl extends BaseDAO implements ParkingRentRuleDAO {

    @Override
	public Long insert(ParkingRentRuleDO parkingRentRule) {
	      try {
                return (Long) getSqlMapperW().insert("parking_rent_rule.insert",parkingRentRule);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public ParkingRentRuleDO getParkingRentRuleById(Long ruleId) {
	    return (ParkingRentRuleDO)getSqlMapClientTemplate().queryForObject("parking_rent_rule.getParkingRentRuleById", ruleId);
	}

    @Override
	public boolean delParkingRentRuleById(Long ruleId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("parking_rent_rule.delParkingRentRuleById",ruleId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<ParkingRentRuleDO> getParkingRentRuleByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("parking_rent_rule.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long ruleId) {
	    try {
            getSqlMapperW().update("parking_rent_rule.cleanAutoIncrement",ruleId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<ParkingRentRuleDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("parking_rent_rule.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("parking_rent_rule.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(ParkingRentRuleDO parkingRentRule) {
        try {
            getSqlMapperW().update("parking_rent_rule.updateByIdSelective",parkingRentRule);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}

